<?
	session_start();
	include('conn.php');
	$obj = json_decode($_REQUEST["dataset"]);
	$opt = $_REQUEST["q"];
	$user=$_SESSION['username'];
	
	switch($opt){
		case 'c':
			//$qry = "insert into STBtype(STBType,Ratepermonth,enteredby,entereddate) values('$obj->type', '$obj->rpm','$user','".date('Y-m-d')."');";		
			$qry = "insert into STBtype(STBType,enteredby,entereddate,status) values('$obj->type','$user','".date('Y-m-d')."','1');";		
			echo "<br> $qry <br>";
			$res = mysql_query($qry);		
			break;
		
		case 'u':
			$id = $obj-> id;
			//$qry = "update STBtype set STBType = '$obj->type', Ratepermonth = '$obj->rpm', modifiedby = '$user', modifieddate = '".date('Y-m-d')."' where stbtypeid='$id';";	
			$qry = "update STBtype set STBType = '$obj->type', modifiedby = '$user', modifieddate = '".date('Y-m-d')."' where stbtypeid='$id';";	
			echo "<br> $qry <br>";
			$res = mysql_query($qry);		
			break;
			
		case 'd':
			$id = $_REQUEST['id'];
			//$qry = "delete FROM STBtype where stbtypeid='$id';";		
			$qry = "update STBtype set status='9' where stbtypeid='$id';";		
			echo "<br> $qry <br>";
			$res = mysql_query($qry);		
			break;
		
		default:
			echo "No option selected";
	}
?>